package sg.nus.iss.vmcs.models;

import java.util.Comparator;
import sg.nus.iss.vmcs.utils.MoneyFormatter;

/**
 * 
 * Changed the type of the value to accomodate the null return value in the chain if went unhandled
 * @author Raj
 * 
 */
public class Coin extends StoreObject{

    private double weight;

    public Coin () {}
    
    public Coin (int value, double weight) {
    	this.name 	= MoneyFormatter.toMoney(value);
        this.value 	= value;
        this.weight = weight;
    }

    public void setValue(Integer v){
    	value = v;
    }

    public void setWeight(double wt){
    	weight = wt;
    }

    public double getWeight () {
        return (weight);
    }

    public static Comparator<Coin> getCoinComparator() {
    	return new Comparator<Coin>() {
			@Override
			public int compare(Coin coin1, Coin coin2) {
				return new Integer(coin1.getValue()).compareTo(new Integer(coin2.getValue()));
			}
    	};
    }
}

